\(\int \cot ^3(c+d x) (a+i a \tan (c+d x))^3 (A+B \tan (c+d x)) \, dx\) [22]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [B] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 34, antiderivative size = 123 \[ \int \cot ^3(c+d x) (a+i a \tan (c+d x))^3 (A+B \tan (c+d x)) \, dx=-4 a^3 (i A+B) x+\frac {i a^3 B \log (\cos (c+d x))}{d}-\frac {a^3 (4 A-3 i B) \log (\sin (c+d x))}{d}-\frac {a A \cot ^2(c+d x) (a+i a \tan (c+d x))^2}{2 d}-\frac {(2 i A+B) \cot (c+d x) \left (a^3+i a^3 \tan (c+d x)\right )}{d} \]

[Out]

-4*a^3*(I*A+B)*x+I*a^3*B*ln(cos(d*x+c))/d-a^3*(4*A-3*I*B)*ln(sin(d*x+c))/d-1/2*a*A*cot(d*x+c)^2*(a+I*a*tan(d*x
+c))^2/d-(2*I*A+B)*cot(d*x+c)*(a^3+I*a^3*tan(d*x+c))/d

Rubi [A] (verified)

Time = 0.35 (sec) , antiderivative size = 123, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.118, Rules used = {3674, 3670, 3556, 3612} \[ \int \cot ^3(c+d x) (a+i a \tan (c+d x))^3 (A+B \tan (c+d x)) \, dx=-\frac {a^3 (4 A-3 i B) \log (\sin (c+d x))}{d}-\frac {(B+2 i A) \cot (c+d x) \left (a^3+i a^3 \tan (c+d x)\right )}{d}-4 a^3 x (B+i A)+\frac {i a^3 B \log (\cos (c+d x))}{d}-\frac {a A \cot ^2(c+d x) (a+i a \tan (c+d x))^2}{2 d} \]

[In]

Int[Cot[c + d*x]^3*(a + I*a*Tan[c + d*x])^3*(A + B*Tan[c + d*x]),x]

[Out]

-4*a^3*(I*A + B)*x + (I*a^3*B*Log[Cos[c + d*x]])/d - (a^3*(4*A - (3*I)*B)*Log[Sin[c + d*x]])/d - (a*A*Cot[c +
d*x]^2*(a + I*a*Tan[c + d*x])^2)/(2*d) - (((2*I)*A + B)*Cot[c + d*x]*(a^3 + I*a^3*Tan[c + d*x]))/d

Rule 3556

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3612

Int[((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(a*c +
b*d)*(x/(a^2 + b^2)), x] + Dist[(b*c - a*d)/(a^2 + b^2), Int[(b - a*Tan[e + f*x])/(a + b*Tan[e + f*x]), x], x]
 /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && NeQ[a*c + b*d, 0]

Rule 3670

Int[(((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]))/((a_.) + (b_.)*tan[(e_.)
 + (f_.)*(x_)]), x_Symbol] :> Dist[B*(d/b), Int[Tan[e + f*x], x], x] + Dist[1/b, Int[Simp[A*b*c + (A*b*d + B*(
b*c - a*d))*Tan[e + f*x], x]/(a + b*Tan[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f, A, B}, x] && NeQ[b*c - a
*d, 0]

Rule 3674

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_
.) + (f_.)*(x_)])^(n_), x_Symbol] :> Simp[(-a^2)*(B*c - A*d)*(a + b*Tan[e + f*x])^(m - 1)*((c + d*Tan[e + f*x]
)^(n + 1)/(d*f*(b*c + a*d)*(n + 1))), x] - Dist[a/(d*(b*c + a*d)*(n + 1)), Int[(a + b*Tan[e + f*x])^(m - 1)*(c
 + d*Tan[e + f*x])^(n + 1)*Simp[A*b*d*(m - n - 2) - B*(b*c*(m - 1) + a*d*(n + 1)) + (a*A*d*(m + n) - B*(a*c*(m
 - 1) + b*d*(n + 1)))*Tan[e + f*x], x], x], x] /; FreeQ[{a, b, c, d, e, f, A, B}, x] && NeQ[b*c - a*d, 0] && E
qQ[a^2 + b^2, 0] && GtQ[m, 1] && LtQ[n, -1]

Rubi steps \begin{align*} \text {integral}& = -\frac {a A \cot ^2(c+d x) (a+i a \tan (c+d x))^2}{2 d}+\frac {1}{2} \int \cot ^2(c+d x) (a+i a \tan (c+d x))^2 (2 a (2 i A+B)+2 i a B \tan (c+d x)) \, dx \\ & = -\frac {a A \cot ^2(c+d x) (a+i a \tan (c+d x))^2}{2 d}-\frac {(2 i A+B) \cot (c+d x) \left (a^3+i a^3 \tan (c+d x)\right )}{d}+\frac {1}{2} \int \cot (c+d x) (a+i a \tan (c+d x)) \left (-2 a^2 (4 A-3 i B)-2 a^2 B \tan (c+d x)\right ) \, dx \\ & = -\frac {a A \cot ^2(c+d x) (a+i a \tan (c+d x))^2}{2 d}-\frac {(2 i A+B) \cot (c+d x) \left (a^3+i a^3 \tan (c+d x)\right )}{d}+\frac {1}{2} \int \cot (c+d x) \left (-2 a^3 (4 A-3 i B)-8 a^3 (i A+B) \tan (c+d x)\right ) \, dx-\left (i a^3 B\right ) \int \tan (c+d x) \, dx \\ & = -4 a^3 (i A+B) x+\frac {i a^3 B \log (\cos (c+d x))}{d}-\frac {a A \cot ^2(c+d x) (a+i a \tan (c+d x))^2}{2 d}-\frac {(2 i A+B) \cot (c+d x) \left (a^3+i a^3 \tan (c+d x)\right )}{d}-\left (a^3 (4 A-3 i B)\right ) \int \cot (c+d x) \, dx \\ & = -4 a^3 (i A+B) x+\frac {i a^3 B \log (\cos (c+d x))}{d}-\frac {a^3 (4 A-3 i B) \log (\sin (c+d x))}{d}-\frac {a A \cot ^2(c+d x) (a+i a \tan (c+d x))^2}{2 d}-\frac {(2 i A+B) \cot (c+d x) \left (a^3+i a^3 \tan (c+d x)\right )}{d} \\ \end{align*}

Mathematica [A] (verified)

Time = 1.10 (sec) , antiderivative size = 75, normalized size of antiderivative = 0.61 \[ \int \cot ^3(c+d x) (a+i a \tan (c+d x))^3 (A+B \tan (c+d x)) \, dx=\frac {a^3 \left ((-6 i A-2 B) \cot (c+d x)-A \cot ^2(c+d x)+(-8 A+6 i B) \log (\tan (c+d x))+8 (A-i B) \log (i+\tan (c+d x))\right )}{2 d} \]

[In]

Integrate[Cot[c + d*x]^3*(a + I*a*Tan[c + d*x])^3*(A + B*Tan[c + d*x]),x]

[Out]

(a^3*(((-6*I)*A - 2*B)*Cot[c + d*x] - A*Cot[c + d*x]^2 + (-8*A + (6*I)*B)*Log[Tan[c + d*x]] + 8*(A - I*B)*Log[
I + Tan[c + d*x]]))/(2*d)

Maple [A] (verified)

Time = 0.21 (sec) , antiderivative size = 92, normalized size of antiderivative = 0.75

method result size
derivativedivides \(-\frac {a^{3} \left (\frac {\left (4 i B -4 A \right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}+\left (4 i A +4 B \right ) \arctan \left (\tan \left (d x +c \right )\right )+\left (-3 i B +4 A \right ) \ln \left (\tan \left (d x +c \right )\right )-\frac {-3 i A -B}{\tan \left (d x +c \right )}+\frac {A}{2 \tan \left (d x +c \right )^{2}}\right )}{d}\) \(92\)
default \(-\frac {a^{3} \left (\frac {\left (4 i B -4 A \right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}+\left (4 i A +4 B \right ) \arctan \left (\tan \left (d x +c \right )\right )+\left (-3 i B +4 A \right ) \ln \left (\tan \left (d x +c \right )\right )-\frac {-3 i A -B}{\tan \left (d x +c \right )}+\frac {A}{2 \tan \left (d x +c \right )^{2}}\right )}{d}\) \(92\)
parallelrisch \(-\frac {a^{3} \left (8 i A x d -6 i B \ln \left (\tan \left (d x +c \right )\right )+4 i B \ln \left (\sec ^{2}\left (d x +c \right )\right )+8 B d x +6 i A \cot \left (d x +c \right )+8 A \ln \left (\tan \left (d x +c \right )\right )-4 A \ln \left (\sec ^{2}\left (d x +c \right )\right )+A \left (\cot ^{2}\left (d x +c \right )\right )+2 \cot \left (d x +c \right ) B \right )}{2 d}\) \(96\)
norman \(\frac {\left (-4 i A \,a^{3}-4 B \,a^{3}\right ) x \left (\tan ^{2}\left (d x +c \right )\right )-\frac {A \,a^{3}}{2 d}-\frac {\left (3 i A \,a^{3}+B \,a^{3}\right ) \tan \left (d x +c \right )}{d}}{\tan \left (d x +c \right )^{2}}-\frac {\left (-3 i B \,a^{3}+4 A \,a^{3}\right ) \ln \left (\tan \left (d x +c \right )\right )}{d}+\frac {2 \left (-i B \,a^{3}+A \,a^{3}\right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{d}\) \(124\)
risch \(\frac {8 a^{3} B c}{d}+\frac {8 i a^{3} A c}{d}-\frac {2 i a^{3} \left (4 i A \,{\mathrm e}^{2 i \left (d x +c \right )}+B \,{\mathrm e}^{2 i \left (d x +c \right )}-3 i A -B \right )}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )^{2}}+\frac {3 i a^{3} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right ) B}{d}-\frac {4 A \,a^{3} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )}{d}+\frac {i a^{3} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) B}{d}\) \(142\)

[In]

int(cot(d*x+c)^3*(a+I*a*tan(d*x+c))^3*(A+B*tan(d*x+c)),x,method=_RETURNVERBOSE)

[Out]

-a^3/d*(1/2*(4*I*B-4*A)*ln(1+tan(d*x+c)^2)+(4*I*A+4*B)*arctan(tan(d*x+c))+(4*A-3*I*B)*ln(tan(d*x+c))-(-3*I*A-B
)/tan(d*x+c)+1/2*A/tan(d*x+c)^2)

Fricas [A] (verification not implemented)

none

Time = 0.26 (sec) , antiderivative size = 179, normalized size of antiderivative = 1.46 \[ \int \cot ^3(c+d x) (a+i a \tan (c+d x))^3 (A+B \tan (c+d x)) \, dx=\frac {2 \, {\left (4 \, A - i \, B\right )} a^{3} e^{\left (2 i \, d x + 2 i \, c\right )} - 2 \, {\left (3 \, A - i \, B\right )} a^{3} + {\left (i \, B a^{3} e^{\left (4 i \, d x + 4 i \, c\right )} - 2 i \, B a^{3} e^{\left (2 i \, d x + 2 i \, c\right )} + i \, B a^{3}\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) - {\left ({\left (4 \, A - 3 i \, B\right )} a^{3} e^{\left (4 i \, d x + 4 i \, c\right )} - 2 \, {\left (4 \, A - 3 i \, B\right )} a^{3} e^{\left (2 i \, d x + 2 i \, c\right )} + {\left (4 \, A - 3 i \, B\right )} a^{3}\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} - 1\right )}{d e^{\left (4 i \, d x + 4 i \, c\right )} - 2 \, d e^{\left (2 i \, d x + 2 i \, c\right )} + d} \]

[In]

integrate(cot(d*x+c)^3*(a+I*a*tan(d*x+c))^3*(A+B*tan(d*x+c)),x, algorithm="fricas")

[Out]

(2*(4*A - I*B)*a^3*e^(2*I*d*x + 2*I*c) - 2*(3*A - I*B)*a^3 + (I*B*a^3*e^(4*I*d*x + 4*I*c) - 2*I*B*a^3*e^(2*I*d
*x + 2*I*c) + I*B*a^3)*log(e^(2*I*d*x + 2*I*c) + 1) - ((4*A - 3*I*B)*a^3*e^(4*I*d*x + 4*I*c) - 2*(4*A - 3*I*B)
*a^3*e^(2*I*d*x + 2*I*c) + (4*A - 3*I*B)*a^3)*log(e^(2*I*d*x + 2*I*c) - 1))/(d*e^(4*I*d*x + 4*I*c) - 2*d*e^(2*
I*d*x + 2*I*c) + d)

Sympy [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 226 vs. \(2 (109) = 218\).

Time = 1.03 (sec) , antiderivative size = 226, normalized size of antiderivative = 1.84 \[ \int \cot ^3(c+d x) (a+i a \tan (c+d x))^3 (A+B \tan (c+d x)) \, dx=\frac {i B a^{3} \log {\left (\frac {2 A a^{3} - i B a^{3}}{2 A a^{3} e^{2 i c} - i B a^{3} e^{2 i c}} + e^{2 i d x} \right )}}{d} - \frac {a^{3} \cdot \left (4 A - 3 i B\right ) \log {\left (e^{2 i d x} + \frac {2 A a^{3} - 2 i B a^{3} - a^{3} \cdot \left (4 A - 3 i B\right )}{2 A a^{3} e^{2 i c} - i B a^{3} e^{2 i c}} \right )}}{d} + \frac {- 6 A a^{3} + 2 i B a^{3} + \left (8 A a^{3} e^{2 i c} - 2 i B a^{3} e^{2 i c}\right ) e^{2 i d x}}{d e^{4 i c} e^{4 i d x} - 2 d e^{2 i c} e^{2 i d x} + d} \]

[In]

integrate(cot(d*x+c)**3*(a+I*a*tan(d*x+c))**3*(A+B*tan(d*x+c)),x)

[Out]

I*B*a**3*log((2*A*a**3 - I*B*a**3)/(2*A*a**3*exp(2*I*c) - I*B*a**3*exp(2*I*c)) + exp(2*I*d*x))/d - a**3*(4*A -
 3*I*B)*log(exp(2*I*d*x) + (2*A*a**3 - 2*I*B*a**3 - a**3*(4*A - 3*I*B))/(2*A*a**3*exp(2*I*c) - I*B*a**3*exp(2*
I*c)))/d + (-6*A*a**3 + 2*I*B*a**3 + (8*A*a**3*exp(2*I*c) - 2*I*B*a**3*exp(2*I*c))*exp(2*I*d*x))/(d*exp(4*I*c)
*exp(4*I*d*x) - 2*d*exp(2*I*c)*exp(2*I*d*x) + d)

Maxima [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 96, normalized size of antiderivative = 0.78 \[ \int \cot ^3(c+d x) (a+i a \tan (c+d x))^3 (A+B \tan (c+d x)) \, dx=-\frac {8 \, {\left (d x + c\right )} {\left (i \, A + B\right )} a^{3} - 4 \, {\left (A - i \, B\right )} a^{3} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) + 2 \, {\left (4 \, A - 3 i \, B\right )} a^{3} \log \left (\tan \left (d x + c\right )\right ) - \frac {2 \, {\left (-3 i \, A - B\right )} a^{3} \tan \left (d x + c\right ) - A a^{3}}{\tan \left (d x + c\right )^{2}}}{2 \, d} \]

[In]

integrate(cot(d*x+c)^3*(a+I*a*tan(d*x+c))^3*(A+B*tan(d*x+c)),x, algorithm="maxima")

[Out]

-1/2*(8*(d*x + c)*(I*A + B)*a^3 - 4*(A - I*B)*a^3*log(tan(d*x + c)^2 + 1) + 2*(4*A - 3*I*B)*a^3*log(tan(d*x +
c)) - (2*(-3*I*A - B)*a^3*tan(d*x + c) - A*a^3)/tan(d*x + c)^2)/d

Giac [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 223 vs. \(2 (109) = 218\).

Time = 1.14 (sec) , antiderivative size = 223, normalized size of antiderivative = 1.81 \[ \int \cot ^3(c+d x) (a+i a \tan (c+d x))^3 (A+B \tan (c+d x)) \, dx=-\frac {A a^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 8 i \, B a^{3} \log \left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1\right ) - 8 i \, B a^{3} \log \left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1\right ) - 12 i \, A a^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 4 \, B a^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 64 \, {\left (A a^{3} - i \, B a^{3}\right )} \log \left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + i\right ) + 8 \, {\left (4 \, A a^{3} - 3 i \, B a^{3}\right )} \log \left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right ) - \frac {48 \, A a^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 36 i \, B a^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 12 i \, A a^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 4 \, B a^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - A a^{3}}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2}}}{8 \, d} \]

[In]

integrate(cot(d*x+c)^3*(a+I*a*tan(d*x+c))^3*(A+B*tan(d*x+c)),x, algorithm="giac")

[Out]

-1/8*(A*a^3*tan(1/2*d*x + 1/2*c)^2 - 8*I*B*a^3*log(tan(1/2*d*x + 1/2*c) + 1) - 8*I*B*a^3*log(tan(1/2*d*x + 1/2
*c) - 1) - 12*I*A*a^3*tan(1/2*d*x + 1/2*c) - 4*B*a^3*tan(1/2*d*x + 1/2*c) - 64*(A*a^3 - I*B*a^3)*log(tan(1/2*d
*x + 1/2*c) + I) + 8*(4*A*a^3 - 3*I*B*a^3)*log(tan(1/2*d*x + 1/2*c)) - (48*A*a^3*tan(1/2*d*x + 1/2*c)^2 - 36*I
*B*a^3*tan(1/2*d*x + 1/2*c)^2 - 12*I*A*a^3*tan(1/2*d*x + 1/2*c) - 4*B*a^3*tan(1/2*d*x + 1/2*c) - A*a^3)/tan(1/
2*d*x + 1/2*c)^2)/d

Mupad [B] (verification not implemented)

Time = 8.12 (sec) , antiderivative size = 88, normalized size of antiderivative = 0.72 \[ \int \cot ^3(c+d x) (a+i a \tan (c+d x))^3 (A+B \tan (c+d x)) \, dx=-\frac {\frac {A\,a^3}{2}+\mathrm {tan}\left (c+d\,x\right )\,\left (B\,a^3+A\,a^3\,3{}\mathrm {i}\right )}{d\,{\mathrm {tan}\left (c+d\,x\right )}^2}-\frac {a^3\,\ln \left (\mathrm {tan}\left (c+d\,x\right )\right )\,\left (4\,A-B\,3{}\mathrm {i}\right )}{d}+\frac {4\,a^3\,\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,\left (A-B\,1{}\mathrm {i}\right )}{d} \]

[In]

int(cot(c + d*x)^3*(A + B*tan(c + d*x))*(a + a*tan(c + d*x)*1i)^3,x)

[Out]

(4*a^3*log(tan(c + d*x) + 1i)*(A - B*1i))/d - (a^3*log(tan(c + d*x))*(4*A - B*3i))/d - ((A*a^3)/2 + tan(c + d*
x)*(A*a^3*3i + B*a^3))/(d*tan(c + d*x)^2)